<template>
  <div>
    <el-button-group>
      <el-button
        style="float: 'left'"
        v-for="item in canUse"
        :type="item.state"
        :key="item.type"
        size="mini"
        @click="handlerClick(item.type)"
        :disabled="requestState"
        >{{ item.label }}</el-button
      >
    </el-button-group>
  </div>
</template>

<script>
import { buttonPower } from "../../config/baseConfig";
import { mapState } from "vuex";
import { EventName as event } from "../../config/event";
export default {
  name: "tableEdit",
  props: ["rowData", "power"],
  mounted() {},
  data() {
    return {
      canUse: {},
    };
  },
  created() {
    let canUse = {};
    this.power.forEach((item) => {
      canUse[item] = buttonPower[item];
    });
    this.canUse = canUse;
  },
  computed: { ...mapState({ requestState: "requestState" }) },
  methods: {
    handlerClick(type) {
      const { rowData } = this;
      this.$bus.emit(event["@User:Manage:Table:Edit"], { type, rowData });
    },
  },
};
</script>

<style lang="less" scoped>
</style>